<?php


class Charge {

    private $id_charge;
    private $id_loc;
    private $nom_charge;
    private $montant_charge;
    private $tva_charge;


    public function __construct($valeur = array()){
        if(!empty($valeur)){
            $this->affecte($valeur);

        }
    }

    public function affecte($donnees){
        foreach ($donnees as  $attribut => $valeur){
            switch($attribut){
                case 'id_charge': $this->setIdCharge($valeur);
                    break;
                case 'id_loc': $this->setIdLoc($valeur);
                    break;
                case 'nom_charge': $this->setNomCharge($valeur);
                    break;
                case 'montant_charge': $this->setMontantCharge($valeur);
                    break;
                case 'tva_charge': $this->setTvaCharge($valeur);
                    break;

            }

        }
    }

    /**
     * @param mixed $id_charge
     */
    public function setIdCharge($id_charge)
    {
        $this->id_charge = $id_charge;
    }

    /**
     * @return mixed
     */
    public function getIdCharge()
    {
        return $this->id_charge;
    }

    /**
     * @param mixed $id_loc
     */
    public function setIdLoc($id_loc)
    {
        LocationRegle::verifId($id_loc, new Mypdo());
        $this->id_loc = $id_loc;
    }

    /**
     * @return mixed
     */
    public function getIdLoc()
    {
        return $this->id_loc;
    }

    /**
     * @param mixed $montant_charge
     */
    public function setMontantCharge($montant_charge)
    {
        $this->montant_charge = $montant_charge;
    }

    /**
     * @return mixed
     */
    public function getMontantCharge()
    {
        return $this->montant_charge;
    }

    /**
     * @param mixed $nom_charge
     */
    public function setNomCharge($nom_charge)
    {
        $this->nom_charge = $nom_charge;
    }

    /**
     * @return mixed
     */
    public function getNomCharge()
    {
        return $this->nom_charge;
    }

    /**
     * @param mixed $tva_charge
     */
    public function setTvaCharge($tva_charge)
    {
        $this->tva_charge = $tva_charge;
    }

    /**
     * @return mixed
     */
    public function getTvaCharge()
    {
        return $this->tva_charge;
    }


} 